namespace added to Helm Chart#345
Conversation
Signed-off-by: Kevin Ho <kevinkh08@gmail.com>
Signed-off-by: Kevin Ho <kevinkh08@gmail.com>
Signed-off-by: Kevin Ho <kevinkh08@gmail.com>
Greptile SummaryThis PR adds
Confidence Score: 3/5The change correctly addresses namespace placement for non-default namespaces but leaves a gap for resources deployed to All 11 templates use a conditional that skips the namespace field when deploying to the All 11 changed templates share the same conditional guard pattern; Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[helm install / helm template] --> B{Release.Namespace}
B -->|"== 'default'"| C[Namespace field OMITTED from manifest]
B -->|"!= 'default'"| D[namespace: Release.Namespace emitted]
C --> E{Applied by?}
E -->|"helm install --namespace default"| F[Helm API call sets namespace ✓]
E -->|"kubectl apply / GitOps tool"| G[kubectl context default namespace used ⚠️]
D --> H[Resource lands in correct namespace ✓]
G --> I{Context namespace == default?}
I -->|Yes| J[Correct namespace ✓]
I -->|No| K[Wrong namespace — issue #344 still present ✗]
Reviews (1): Last reviewed commit: "added namespace to topograph node-data-b..." | Re-trigger Greptile |
| {{- if ne .Release.Namespace "default" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end}} |
There was a problem hiding this comment.
Non-standard conditional omits namespace for
default
Every changed template guards the namespace field with {{- if ne .Release.Namespace "default" }}, which means rendering with --namespace default (or no --namespace flag) produces manifests without an explicit namespace: field. When those manifests are applied through a GitOps tool such as ArgoCD or Flux, the resource is placed into whatever the cluster's contextual default namespace is rather than default — recreating the very bug (#344) this PR intends to fix, just scoped to that one namespace.
The Helm-recommended pattern is to emit the namespace unconditionally: namespace: {{ .Release.Namespace }}. The same conditional appears in all 11 files changed by this PR.
There was a problem hiding this comment.
This was to retain compatibility with how helm template functioned before.
If user specifies namespace=default or omits it, they are free to kubectl apply to any namespace they choose.
If namespace: default is in the manifest, it must be applied to the default namespace.
Can remove the conditional if we are fine with changing the default behavior.
Description
Adds
metadata.namespaceto namespace scoped resources in the Helm Chart Templates.Addresses #344
Checklist
git commit -s).